<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <!-- 引入vue2的js文件 -->
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.7.9/vue.js"></script>
  </head>
  <body>
    <div id="app">
      <p>用户名：<input type="text" v-model="username" /></p>
      <p>密码：<input type="text" v-model="password" /></p>
      <button @click="login">登录</button>
    </div>

    <script>
      // MVVVM中的ViewModel
      new Vue({
        el: '#app', // vue解析的节点
        data: {
          username: 'admin',
          password: '123'
        },
        methods: {
          login() {
            console.log(this.username, this.password)
          }
        }
      })
    </script>
  </body>
</html>
